package com.xinwei.test;

public class test {
    public static void main(String[] args) {
        test test = new test();
        User user = new User();
        user.setAge(18);
        user.setUsername("张三");
        System.out.println(user);
        test.change(user);
        System.out.println(user);
    }

    public void change(User user) {
        user = new User();
        user.setAge(20);
        user.setUsername("李四");
        System.out.println(user);
    }
}

class User {
    Integer age;
    String username;

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    @Override
    public String toString() {
        return "User{" +
                "age=" + age +
                ", username='" + username + '\'' +
                '}';
    }
}
